* This uses the thid and fourth wave of the 2008 NAES, available upon request: https://www.annenbergpublicpolicycenter.org/data-access/

gen pid = MA01_3 
gen party = 1 if pid<4
replace party = 0 if pid>4
replace party = . if pid==.

gen obama3= ABo02_3
gen mccain3 = AAm01_3
replace mccain3 = . if mccain3>100
replace obama3 = . if obama3>100

gen in_party3 = obama3 if party==0
replace in_party3 = mccain3 if party==1

gen out_party3 = obama3 if party==1
replace out_party3 = mccain3 if party==0

gen affect3 = in_party3-out_party3

gen obama4= ABo02_4
gen mccain4 = AAm01_4
replace mccain4 = . if mccain4>100
replace obama4 = . if obama4>100

gen in_party4 = obama4 if party==0
replace in_party4 = mccain4 if party==1

gen out_party4 = obama4 if party==1
replace out_party4 = mccain4 if party==0

gen affect4 = in_party4-out_party4




mean affect3 affect4
ttest affect3 = affect4

mean in_party3 in_party4 out_party3 out_party4 
ttest in_party3 = in_party4
ttest out_party3 = out_party4

replace affect3 = affect3/100
replace affect4 = affect4/100
